package 队列实现栈;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;

/**
 * @author wtcode
 * @date 2021/3/26 - 11:18
 */
public class MyStack {
    Queue<Integer> q1;
    Queue<Integer> q2;

    public MyStack() {
        this.q1 = new LinkedList<>();
        this.q2 = new LinkedList<>();
        Stack<Object> stack = new Stack<>();
    }

    public void push(int x){
        q2.offer(x);
        while(!q1.isEmpty()){
            q2.offer(q1.poll());
        }
        Queue<Integer> temp = q1;
        q1 = q2;
        q2 = temp;
    }



}
